package com.csun.cmny.provider.controller.rpc;

import com.csun.cmny.provider.model.dto.watch.OldmanBindWatchReqDto;
import com.csun.cmny.provider.model.enums.device.DmcDeviceTypeEnum;
import com.csun.cmny.provider.service.DmcWatchOldmanFeignApi;
import com.csun.cmny.provider.service.DmcWatchOldmanService;
import com.csun.cmny.util.wrapper.WrapMapper;
import com.csun.cmny.util.wrapper.Wrapper;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-03-13 14:07
 * @Description: the class dmc watch oldman feign client
 */
@RestController
public class DmcWatchOldmanFeignClient implements DmcWatchOldmanFeignApi {

    @Resource
    private DmcWatchOldmanService dmcWatchOldmanService;

    /**
     * 查询绑定了孝心手环的老人列表
     *
     * @param oldmanBindWatchReqDto oldman bind watch watch req dto
     * @return
     */
    @Override
    public Wrapper<List<Integer>> queryOldmanBindWatchList(@RequestBody OldmanBindWatchReqDto oldmanBindWatchReqDto) {

        oldmanBindWatchReqDto.setDeviceType(DmcDeviceTypeEnum.XX_WATCH.getIndex());

        List<Integer> oldmanIdList = dmcWatchOldmanService.queryOldmanBindWatchList(oldmanBindWatchReqDto);

        return WrapMapper.ok(oldmanIdList);
    }
}
